package com.system.login.dao;

import com.system.login.dataobject.GaoyuanLoginsystem;

import java.util.List;

import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Component;

@Component
@Mapper
public interface GaoyuanLoginsystemMapper {
    @Insert({
            "insert into gaoyuan_loginsystem (sex, pwd, ",
            "email, name)",
            "values (#{sex,jdbcType=VARCHAR}, #{pwd,jdbcType=VARCHAR}, ",
            "#{email,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR})"
    })
    int insert(GaoyuanLoginsystem record);


    @Select({
            "select",
            "name, email, pwd,sex",
            "from gaoyuan_loginsystem",
            "where name=#{name}"
    })
    @ResultMap("user")
    GaoyuanLoginsystem selectByName(@Param("name") String name);


    @Select({
            "select",
            "name, email, pwd,sex",
            "from gaoyuan_loginmessage",
            "where email=#{email}"
    })
    @ResultMap("user")
    GaoyuanLoginsystem selectByEmail(@Param("email") String email);


    @Select({
            "select",
            "sex, pwd, email, name",
            "from gaoyuan_loginsystem"
    })
    @Results(id = "user", value = {
            @Result(column = "sex", property = "sex", jdbcType = JdbcType.VARCHAR),
            @Result(column = "pwd", property = "pwd", jdbcType = JdbcType.VARCHAR),
            @Result(column = "email", property = "email", jdbcType = JdbcType.VARCHAR),
            @Result(column = "name", property = "name", jdbcType = JdbcType.VARCHAR)
    })
    List<GaoyuanLoginsystem> selectAll(@Param("email") String email, @Param("sex") String sex, @Param("name") String name, @Param("pwd") String pwd);
}